package cc.z8g.browser.core.view

import android.annotation.SuppressLint
import android.view.MotionEvent
import android.view.View

/**
 * 用于打包并执行[delegates]里的触摸事件
 */
class CompositeTouchListener(val delegates: MutableMap<String, View.OnTouchListener?> = mutableMapOf()) : View.OnTouchListener {

    @SuppressLint("ClickableViewAccessibility")
    override fun onTouch(v: View, event: MotionEvent): Boolean {
        delegates.values.forEach { it?.onTouch(v, event) }
        return false
    }

}
